#include <iostream>
#include <algorithm>

using namespace std;

long long a, c, p, q, r, x, time0, time1;

int fun()
{
    if (a < c) 
    {
        time0 = (c - a) * p;  
    }
    if (a <= c)
    {
        time1 = q;
    }

    if (x < time0)
    {
        return a + x / p;
    }
    if (x < time0 + time1)
    {
        return c;
    }
    
    return max(c, a) + (x - time0 - time1) / r;
}

int main(int argc, char const *argv[])
{
    cin >> a >> c >> p >> q >> r >> x;
    cout << fun();
    return 0;
}
